@extends('admin::layouts.master')
@section('title')
    优惠券-用户列表
@endsection
@section('tab')
    {{--<div class="x-nav">--}}
            {{--<span class="layui-breadcrumb">--}}
                {{--<a>首页</a>--}}
                {{--<a>优惠券管理</a>--}}
                {{--<a><cite>统计列表</cite></a>--}}
            {{--</span>--}}
        {{--<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">--}}
            {{--<i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>--}}
        {{--</a>--}}
    {{--</div>--}}
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body ">
                        <form class="layui-form layui-col-space5" id="form1">
                          <!--   <div class="layui-input-inline layui-show-xs-block" style="width: 300px;">
                                <input type="text" name="name" placeholder="点击用户名自动填充" value="{{$arr_search['name']}}" autocomplete="off" class="layui-input"></div>
                            <input type="hidden" name="user_id" value="{{$arr_search['user_id']}}">

                            <div class="layui-input-inline layui-show-xs-block">
                                <select name="status">
                                    <option value="">使用状态</option>
                                    <option value="1" @if( $arr_search['status'] == 1  ) selected="" @endif >未使用</option>
                                    <option value="2" @if( $arr_search['status'] == 2  ) selected="" @endif >已使用</option>
                                    <option value="3" @if( $arr_search['status'] == 3  ) selected="" @endif >已过期</option>
                                </select>
                            </div>
                            <div class="layui-input-inline layui-show-xs-block" style="width: 300px;">
                                <input type="text" name="ticket_num" placeholder="请输入优惠券券号" value="{{$arr_search['ticket_num']}}" autocomplete="off" class="layui-input"></div>
                            <div class="layui-input-inline layui-show-xs-block">
                                <button class="layui-btn" lay-submit="" lay-filter="sreach">
                                    <i class="layui-icon">&#xe615;</i></button>
                            </div> -->
                        </form>
                    </div>
                   
                    <div class="layui-card-body ">
                        <table class="layui-table layui-form">
                            <thead>
                            <tr>
                                <th>编号</th>
                                <th>优惠券名称</th>
                                <th>优惠券券号</th>
                                <th>优惠券类型</th>
                                <th>用户名</th>
                                <th>领取时间</th>
                                <th>领取说明</th>
                                @if( $arr_search['status'] == 3 )
                                    <th>过期时间</th>
                                @elseif( $arr_search['status'] == 2 )
                                    <th>使用时间</th>
                                    <th>使用说明</th>
                                @endif
                            </thead>
                            <tbody>
                            @foreach($data as $key=>$value)
                            <tr>
                                <td>{{ $value['id'] }}</td>
                                <td>{{ $value['get_coupon_info']['name'] }}</td>
                                <td>{{ $value['ticket_num'] }}</td>
                                <td>{{ $value['get_coupon_info']['pid_msg'] }}</td>
                                <td>{{ $value['get_user_info']['nickname'] }}</td>
                                <td>{{ $value['created_at'] }}</td>
                                <td>{{ $value['msg'] }}</td>
                                @if( $arr_search['status'] == 3 )
                                    <td>{{ $value['over_at'] }}</td>
                                @elseif( $arr_search['status'] == 2 )
                                    <td>{{ $value['updated_at'] }}</td>
                                    <td>{{ $value['use_msg'] }}</td>
                                @endif
                            </tr>
                            @endforeach
                            @if(empty($data))
                                <td colspan="66" align="center">暂无数据</td>
                            @endif
                            </tbody>
                        </table>
                    </div>
                    <div class="layui-card-body ">
                        <div class="page">
                            {{$page_link}}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

@endsection


@section('tab_js')
    <script>
        layui.use(['form', 'layer', 'jquery'], function () {
        $ = layui.jquery;
        var form = layui.form,
            layer = layui.layer;

            $(".click_a").click(function(){
                var user_id = $(this).attr('data-id');
                $("input[name='user_id']").val( user_id );
                $("input[name='name']").val( $(this).text() );
                $("#form1").submit();
            })
        })
    </script>
@endsection




